<template>
    <div>
        <el-row>
            <el-col :span="24">
                <el-form :inline="true">
                    <el-form-item label="编号">
                        <el-input v-model="checkParam.ckNo" placeholder="编号"></el-input>
                    </el-form-item>


                    <el-form-item label="检查项目">
                       
                            <el-input  v-model="checkParam.ckProjectName" placeholder="检查项目"></el-input>
                        
                    </el-form-item>
                    <el-form-item label="病人姓名">
                        <el-input  v-model="checkParam.name" placeholder="病人姓名"></el-input>
                       
                    </el-form-item>
                    <el-form-item label="申请医生">
                        <el-input v-model="checkParam.docName" placeholder="申请医生"></el-input>
                        
                    </el-form-item>


                    <el-form-item>
                        <el-button type="primary" @click="queryCondition">查询</el-button>
                    </el-form-item>
                </el-form>
            </el-col>
        </el-row>

   
        <el-row>
            <el-col :span="24">
                <el-table :data="tableData" @selection-change="handleSelectionChange" style="width: 100%">
                    <el-table-column type="selection" width="55">
                    </el-table-column>
       
              
                    <el-table-column prop="ckNo" label="申请编号" align="center" width="180">
                    </el-table-column>

                    <el-table-column prop="name" label="病人姓名" align="center" width="180">
                    </el-table-column>
                    <el-table-column prop="ckProjectName" label="检查项目" align="center" width="180">
                    </el-table-column>
                    <el-table-column prop="ckProjectPrice" label="价格" align="center" width="180">
                    </el-table-column>

                    <el-table-column prop="docName" label="申请医生" align="center" width="180">
                    </el-table-column>



                    <el-table-column label="操作">
                        <template slot-scope="scope">
                            
                            <el-button type="primary" @click="PayMent(scope.row.ckNo)">缴费</el-button>

                        </template>

                    </el-table-column>
                </el-table>

            </el-col>
        </el-row>
        <el-row>
            <el-col :span="24">
                <!-- 放分页 -->
                <el-pagination background :page-sizes="[4, 10, 20, 50]" :page-size="pageSize" :current-page="pageNum"
                    @next-click="nextPage" @prev-click="prevPage" @size-change="handleSizeChange"
                    @current-change="handleCurrentChange" layout=" total,sizes,prev, pager, next" :total="total">
                </el-pagination>
            </el-col>

        </el-row>
    </div>
</template>

<script>
export default {
    data() {
        return {
            pageNum: "1",
            pageSize: "4",
            total: 0,
            tableData: [],

            selectionData: [],
        
            checkParam: {
                ckNo: "",
                ckProjectName: "",
                name: "",
                docName: ""

            },
            ckNo: "",
                ckProjectName: "",
                name: "",
                docName: ""
                

        }
    },
    methods: {
        prevPage(val) {
            this.pageNum = val;
            this.queryAd();
        },
        nextPage(val) {
            //点击下一页触发

            this.pageNum = val;
            this.queryAd();
        },
        queryCondition() {
            this.pageNum = 1;
            this.queryAd();
        },
        handleSizeChange(val) {
            //改变每页条数触发
            this.pageNum = 1;
            this.pageSize = val;
            this.queryAd();
        },
        handleCurrentChange(val) {
            this.pageNum = val;
            this.queryAd();


        },
        PayMent(ckNo){
            window.open("http://localhost:8092/alipay/pay?ckNo="+ckNo);
            let param={}
            param.ckNo=ckNo
            this.$axios.post('api/alipay/pay',param)
            .then(res=>{
               

            })
        },
     
        handleSelectionChange(val) {
            console.log(val)
            //选中的对象数组
            this.selectionData = val;

        },


       
        queryAd() {
            let pageParam = {}
            pageParam.pageNum = this.pageNum
            pageParam.pageSize = this.pageSize
            pageParam.param = this.checkParam
            this.$axios.post('api/checkMoney/queryAll', pageParam)
                .then(res => {
                    console.log(res.data)
                    if (res.data.code == 200) {
                        this.tableData = res.data.data.list;
                        this.pageNum = res.data.data.pageNum
                        this.pageSize = res.data.data.pageSize
                        this.total = res.data.data.total
                        console.log(this.tableData)
                    }
                })
        },
   


    },
    created() {
        this.queryAd();
       
    }
}
</script>

<style scoped></style>